package com.tc.quartz.support.bean;

import com.tc.quartz.frame.base.BaseModel;
import com.tc.quartz.frame.common.DateUtil;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 定时器日志bean
 * @author yongjin.ye
 *
 */
public class JobRunLogBean extends BaseModel {
	
	private static final long serialVersionUID = 1L;
	
	/** 自增 */
	private Long id;
	/** 触发实例name */
	private String fireInstanceName;
	/** 调度器名称 */
	private String schedName;
	/** 任务所属组 */
	private String jobGroup;
	/** 任务名称 */
	private String jobName;
	/** 任务描述 */
	private String jobDesc;
	private String jobClassName;
	/** job运行参数 */
	private String jobDataMap;
	private String triggerType;
	/** 计划本次触发时间 */
	private Long planFireTime;
	/** 计划下次触发时间 */
	private Long nextFireTime;
	/** 实际开始时间 */
	private Long runStartTime;
	/** 实际结束时间 */
	private Long runEndTime;
	/** 运行耗时 单位：毫秒 */
	private Long runUsedTime;
	/** 运行结果code 0000成功, 0001执行中,0009重复执行,9999未知异常 */
	private String resultCode;
	/** 运行结果描述 */
	private String resultMsg;
	/** 备注 一般存放job运行时候的信息和异常信息 */
	private String remark;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFireInstanceName() {
		/*if(null != fireInstanceName){
			fireInstanceName = fireInstanceName.replaceAll("14.*", "");
		}*/
		return fireInstanceName;
	}

	public void setFireInstanceName(String fireInstanceName) {
		this.fireInstanceName = fireInstanceName;
	}

	public String getSchedName() {
		return schedName;
	}

	public void setSchedName(String schedName) {
		this.schedName = schedName;
	}

	public String getJobGroup() {
		return jobGroup;
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getJobDesc() {
		return jobDesc;
	}

	public void setJobDesc(String jobDesc) {
		this.jobDesc = jobDesc;
	}

	public String getJobDataMap() {
		return jobDataMap;
	}

	public void setJobDataMap(String jobDataMap) {
		this.jobDataMap = jobDataMap;
	}

	public Long getPlanFireTime() {
		return planFireTime;
	}

	public void setPlanFireTime(Long planFireTime) {
		this.planFireTime = planFireTime;
	}

	public Long getNextFireTime() {
		return nextFireTime;
	}

	public void setNextFireTime(Long nextFireTime) {
		this.nextFireTime = nextFireTime;
	}

	public Long getRunStartTime() {
		return runStartTime;
	}

	public void setRunStartTime(Long runStartTime) {
		this.runStartTime = runStartTime;
	}

	public Long getRunEndTime() {
		return runEndTime;
	}

	public void setRunEndTime(Long runEndTime) {
		this.runEndTime = runEndTime;
	}

	public Long getRunUsedTime() {
		return runUsedTime;
	}

	public void setRunUsedTime(Long runUsedTime) {
		this.runUsedTime = runUsedTime;
	}

	public String getResultCode() {
		return resultCode;
	}

	public void setResultCode(String resultCode) {
		this.resultCode = resultCode;
	}

	public String getResultMsg() {
		return resultMsg;
	}

	public void setResultMsg(String resultMsg) {
		this.resultMsg = resultMsg;
	}


	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getJobClassName() {
		return jobClassName;
	}

	public void setJobClassName(String jobClassName) {
		this.jobClassName = jobClassName;
	}

	public String getTriggerType() {
		return triggerType;
	}

	public void setTriggerType(String triggerType) {
		this.triggerType = triggerType;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}

	//return DateUtil.formatDate(this.trigEndTime, "yyyy-MM-dd HH:mm:ss:SSS");

	public String getPlanFireTimeFormat() {
		return DateUtil.formatDate(this.planFireTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}

	public String getNextFireTimeFormat() {
		return DateUtil.formatDate(this.nextFireTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}

	public String getRunStartTimeFormat() {
		return DateUtil.formatDate(this.runStartTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}

	public String getRunEndTimeFormat() {
		return DateUtil.formatDate(this.runEndTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}
}
